import Vue from 'vue'
import App from './App.vue'
import router from './router' // router
import store from './store' // vuex
import Vant from 'vant'
import 'vant/lib/index.css' // 导入vant的css文件
import 'amfe-flexible' // 设置页面中的html标签字体大小
import 'normalize.css' // 导入normalize.css,去掉了各浏览器间的差异
import '@/style/iconfont/iconfont.css' // 引入 iconfont
import '@/style/main.css' // 引入基本css样式
import '@/api/request'
import axios from 'axios'
import moment from 'moment'
import hmttNavBar from '@/components/hmttNavBar.vue'
Vue.component('hmttNavBar', hmttNavBar) // 使用全局组件 hmttNavBar
Vue.use(Vant) // 注册
Vue.prototype.$axios = axios

Vue.config.productionTip = false
Vue.filter('formatTime', function (str) {
  const a = moment()
  const b = moment(str)
  const _diff = a.diff(b, 'h')
  if (_diff <= 1) {
    return '刚刚'
  } else if (_diff < 24) {
    return _diff + '小时前'
  } else {
    return moment(str).format('YYYY/MM/DD HH:mm:ss')
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
